Function.RegisterNamespace("xUnit.js.Attributes");

xUnit.js.Attributes.MockAttribute=function(mock1,mock2,mockN){
    // Public Members (Can't declare, this is global scope!)
    // this.Mocks

    // ctor
    function MockAttribute(mock1,mock2,mockN){
        this.base("Mock");
        if(!Object.IsType(Function,this.Target))throw new Error("xUnit.js.Attributes.MockAttribute.ctor: unable to locate attribute target.");
        this.Mocks=arguments.length==1&&Object.IsType(Array,arguments[0])?arguments[0]:Array.Copy(arguments);
        if(Object.IsType(Function,this.Target.GetDecoration)){
            var targetMethod=this.Target.GetDecoration().GetMethod();
            if(targetMethod.GetModel){
                var model=targetMethod.GetModel();
                if(Object.Implements(xUnit.js.Model.IMockable,model)){
                    Array.ForEach(this.Mocks,model.AddMock);
                }
            }
        }
    }
    return System.Script.DelayedConstructor(this,xUnit.js.Attributes.MockAttribute,MockAttribute,arguments);
}

xUnit.js.Attributes.MockAttribute.Inherit(System.Script.Attributes.Attribute);
